package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Objects;

@Entity
@Table(name = "return_goods", schema = "jinsanjiao", catalog = "")
public class ReturnGoods {
    private int returnGoodsId;
    private Long returnGoodsAllquantity;
    private Timestamp returnGoodsTime;
    private String returnGoodsReason;
    private Long returnGoodsTotal;
    private String outboundPeople7;
    private Supplier supplierBySupplierId;
    private Collection<ReturnGoodsDetails> returnGoodsDetailsByReturnGoodsId;

    @Id
    @Column(name = "return_goods_id", nullable = false)
    public int getReturnGoodsId() {
        return returnGoodsId;
    }

    public void setReturnGoodsId(int returnGoodsId) {
        this.returnGoodsId = returnGoodsId;
    }

    @Basic
    @Column(name = "return_goods_allquantity", nullable = true, precision = 0)
    public Long getReturnGoodsAllquantity() {
        return returnGoodsAllquantity;
    }

    public void setReturnGoodsAllquantity(Long returnGoodsAllquantity) {
        this.returnGoodsAllquantity = returnGoodsAllquantity;
    }

    @Basic
    @Column(name = "return_goods_time", nullable = true)
    public Timestamp getReturnGoodsTime() {
        return returnGoodsTime;
    }

    public void setReturnGoodsTime(Timestamp returnGoodsTime) {
        this.returnGoodsTime = returnGoodsTime;
    }

    @Basic
    @Column(name = "return_goods_reason", nullable = true, length = 30)
    public String getReturnGoodsReason() {
        return returnGoodsReason;
    }

    public void setReturnGoodsReason(String returnGoodsReason) {
        this.returnGoodsReason = returnGoodsReason;
    }

    @Basic
    @Column(name = "return_goods_total", nullable = true, precision = 0)
    public Long getReturnGoodsTotal() {
        return returnGoodsTotal;
    }

    public void setReturnGoodsTotal(Long returnGoodsTotal) {
        this.returnGoodsTotal = returnGoodsTotal;
    }

    @Basic
    @Column(name = "outbound_people7", nullable = true, length = 50)
    public String getOutboundPeople7() {
        return outboundPeople7;
    }

    public void setOutboundPeople7(String outboundPeople7) {
        this.outboundPeople7 = outboundPeople7;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ReturnGoods that = (ReturnGoods) o;
        return returnGoodsId == that.returnGoodsId &&
                Objects.equals(returnGoodsAllquantity, that.returnGoodsAllquantity) &&
                Objects.equals(returnGoodsTime, that.returnGoodsTime) &&
                Objects.equals(returnGoodsReason, that.returnGoodsReason) &&
                Objects.equals(returnGoodsTotal, that.returnGoodsTotal) &&
                Objects.equals(outboundPeople7, that.outboundPeople7);
    }

    @Override
    public int hashCode() {
        return Objects.hash(returnGoodsId, returnGoodsAllquantity, returnGoodsTime, returnGoodsReason, returnGoodsTotal, outboundPeople7);
    }

    @ManyToOne
    @JoinColumn(name = "supplier_id", referencedColumnName = "supplier_id")
    public Supplier getSupplierBySupplierId() {
        return supplierBySupplierId;
    }

    public void setSupplierBySupplierId(Supplier supplierBySupplierId) {
        this.supplierBySupplierId = supplierBySupplierId;
    }

    @OneToMany(mappedBy = "returnGoodsByReturnGoodsId")
    public Collection<ReturnGoodsDetails> getReturnGoodsDetailsByReturnGoodsId() {
        return returnGoodsDetailsByReturnGoodsId;
    }

    public void setReturnGoodsDetailsByReturnGoodsId(Collection<ReturnGoodsDetails> returnGoodsDetailsByReturnGoodsId) {
        this.returnGoodsDetailsByReturnGoodsId = returnGoodsDetailsByReturnGoodsId;
    }
}
